import {createRouter, createWebHashHistory} from "vue-router"


// 定义路由
const routes = [
    {
        path: '/',
        redirect: '/login'
    },
    {
        path: '/login',
        name: 'Login',
        component: () => import('../views/Login.vue')
    },
    {
        path: '/register',
        name: 'Register',
        component: () => import('../views/Register.vue')
    },
    {
        path: '/home',
        name: 'Home',
        component: () => import('../views/Home.vue'),
    },
]

// 创建路由实例并且传递`routes`配置
const router = createRouter({
    history: createWebHashHistory(import.meta.env.BASE_URL),// 使用历史模式
    routes, // 可以缩写为 routes
})


// 导出实例
export default router